//
//  DocTableViewCell.m
//  ZAKER
//
//  Created by dllo on 15/8/25.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "DocTableViewCell.h"

@interface DocTableViewCell ()

@property (nonatomic, retain) UIImageView *thumbnailImage;
@property (nonatomic, retain) CUSFlashLabel *titleLabel;
@property (nonatomic, retain) UILabel *commentsLabel;
@property (nonatomic, retain) UILabel *updateTime;
@property (nonatomic, retain)UIImageView *comImage;

@end

@implementation DocTableViewCell

-(void)dealloc
{
    
    [_thumbnailImage release];
    [_titleLabel release];
    [_commentsLabel release];
    [_updateTime release];
    [_comImage release];
    
    [super dealloc];
    
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        self.thumbnailImage = [[[UIImageView alloc]initWithFrame:CGRectMake(10 * myWidth, 10 * myHeight, 100 * myWidth, 100 * myHeight)] autorelease];
        [self.contentView addSubview:_thumbnailImage];
//        [_thumbnailImage release];
        
        
         NSInteger width = [UIScreen mainScreen].bounds.size.width - 120 * myWidth - 10 * myWidth;
        self.titleLabel = [[[ CUSFlashLabel alloc]initWithFrame:CGRectMake(120 , 10, (int)width, 100)] autorelease];
        _titleLabel.numberOfLines = 0;
        [_titleLabel setContentMode:UIViewContentModeCenter];
        [_titleLabel setTextColor:[UIColor redColor]];
        [_titleLabel setSpotlightColor:[UIColor yellowColor]];
        [_titleLabel startAnimating];
        [self.contentView addSubview:_titleLabel];
//        [_titleLabel release];
        
        
        self.commentsLabel = [[[UILabel alloc]initWithFrame:CGRectMake(310 * myWidth, 80 * myHeight, 50 * myWidth, 40 * myHeight)] autorelease];
        _commentsLabel.textAlignment = 1;
        _commentsLabel.font = [UIFont systemFontOfSize:15 * myHeight];
        [self.contentView addSubview:_commentsLabel];
//        [_commentsLabel release];
        
        
        self.comImage = [[[UIImageView alloc]initWithFrame:CGRectMake(350 * myWidth, 93 * myHeight, 15 * myWidth, 15 * myHeight)] autorelease];
        [self.contentView addSubview:_comImage];
//        [_comImage release];
        
        
        self.updateTime = [[[UILabel alloc]initWithFrame:CGRectMake(120 * myWidth, 80 * myHeight, 150 * myWidth, 40 * myHeight)] autorelease];
        _updateTime.font = [UIFont systemFontOfSize:15 * myHeight];
        _updateTime.textAlignment = 1;
        [self.contentView addSubview:_updateTime];
//        [_updateTime release];
        
        
    }
    
    return self;
    
}


-(void)setValuesWithModel:(HotModel *)model
{
    
    [self.thumbnailImage sd_setImageWithURL:[NSURL URLWithString:model.thumbnail] placeholderImage:[UIImage imageNamed:@"pla.jpg"]];
    self.titleLabel.text = model.title;
    self.commentsLabel.text = model.comments;
    self.updateTime.text = model.updateTime;
    self.comImage.image = [UIImage imageNamed:@"p.png"];
    
}

- (void)awakeFromNib
{
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    
    [super setSelected:selected animated:animated];

}

@end
